#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: twl
@date: 2022/6/1 10:03
@description:
"""
import json
from flask import Flask, render_template, jsonify, request, Blueprint
from base.entity.base_entity import db

bluetooth = Blueprint('bluetooth', __name__, template_folder='templates', static_folder="static")


@bluetooth.route("/tagcloud", methods=['GET'])
def index():
    # register_dict = request.args
    scDate = request.args.get('scDate', '')
    if scDate == "":
        return '<h1>scDate日期参数没有传</h1>'
    flask_data = 'Hello Flask!'
    sql = """
      SELECT * FROM `bluetooth_name_group` where sc_date = '%s'
    """ % (scDate)
    data = db.session.execute(sql).fetchall()
    if len(data) == 0:
        return '<h1>没有查询到数据</h1>'
    return render_template('bluetooth_tagcloud.html', flask_data=data)
